package com.wt.controller;

import com.wt.pojo.User;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("/user")
public class ProviderUserController {

    @PostMapping
    public String add(@RequestBody User u){
        System.out.println("111add "+u);
        return "ok add";
    }

    @DeleteMapping("/{id}")
    public String delete(@PathVariable("id") Integer id){
        System.out.println("111del "+id);
        return "ok del";
    }

    @PutMapping
    public String update(@RequestBody User u){
        System.out.println("111put "+u);
        return "ok upd";
    }

    @GetMapping
    public String getUser(String name,Integer age){
        System.out.println("111===name="+name+"-----age="+age);
        return "ok get";
    }

    @GetMapping("/list")
    public List<User> list(User u){
        List<User> list = new ArrayList<>();
        list.add(u);
        System.out.println("1111list="+list);
        return list;
    }
}
